home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / kcl / kcl.lha / bin / build_o.c next >
C/C++ Source or Header  |  1985-09-06  |  404b  |  28 lines

  1. #include <stdio.h>
  2.  
  3. main(argc, argv)
  4. int argc;
  5. char **argv;
  6. {
  7.     FILE *datafile, *ofile;
  8.     int i, c;
  9.  
  10.     if (argc != 3) {
  11.         fprintf(stderr, "Arg count.\n");
  12.         exit(1);
  13.     }
  14.     datafile = fopen(argv[1], "r");
  15.     ofile = fopen(argv[2], "a");
  16.     i = 0;
  17.     for (;;) {
  18.         c = getc(datafile);
  19.         if (feof(datafile))
  20.             break;
  21.         putc(c, ofile);
  22.         i++;
  23.     }
  24.     fwrite((char *)(&i), 4, 1, ofile);
  25.     fclose(datafile);
  26.     fclose(ofile);
  27. }
  28.